From 4d8af8596635a01186ed762aa6c47d81e5cd867e Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 19 May 2010 08:18:51 +0100 Subject: [PATCH] xl: recognize the "extra" entry in the domain config file "extra" defines extra parameters to be added to the kernel command line, so append it accordingly. Signed-off-by: Jeremy Fitzhardinge --- tools/libxl/xl_cmdimpl.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 9c37d43e84..768547e4dd 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -507,14 +507,25 @@ static void parse_config_data(const char *configfile_filename_report, if (!xlu_cfg_get_long (config, "viridian", &l)) b_info->u.hvm.viridian = l; } else { - char *cmdline; - if (!xlu_cfg_get_string (config, "root", &buf)) { - if (asprintf(&cmdline, "root=%s", buf) < 0) { - fprintf(stderr, "Failed to allocate memory in asprintf\n"); - exit(1); - } - b_info->u.pv.cmdline = cmdline; + char *cmdline = NULL; + const char *root = NULL, *extra = ""; + + xlu_cfg_get_string (config, "root", &root); + xlu_cfg_get_string (config, "extra", &extra); + + if (root) { + if (asprintf(&cmdline, "root=%s %s", root, extra) == -1) + cmdline = NULL; + } else { + cmdline = strdup(extra); } + + if ((root || extra) && !cmdline) { + fprintf(stderr, "Failed to allocate memory for cmdline\n"); + exit(1); + } + + b_info->u.pv.cmdline = cmdline; if (!xlu_cfg_get_string (config, "ramdisk", &buf)) b_info->u.pv.ramdisk = strdup(buf); } -- 2.30.2